<template>
  <div class="pages">
    <div class="nav">
      <div class="tabtop">
        <div v-for="(item, index) in navList" :key="index" @click="chooseNav(item.id)">
          <div :class="currenindex == index ? 'active' : 'text'">{{ item.value }}</div>
        </div>
      </div>
    </div>
    <syncDatasource v-if="currenindex==0" />
    <syncTask v-if="currenindex==1" />
  </div>
</template>
<script>
const syncDatasource = () => import('./syncDatasource.vue')
const syncTask = () => import('./syncTask.vue')
export default {
  components: {
    syncDatasource,
    syncTask
  },
  data() {
    return {
      navList: [
        { id: 0, value: '同步数据源' },
        { id: 1, value: '同步任务' }
      ],
      currenindex: 0,
    }
  },
  methods: {
    chooseNav(num) {
      this.currenindex = num
    }
  },

}
</script>
<style lang="scss" scoped>
.tabtop {
  width: 381px;
}
.nav {
  padding: 20px;
}
.pages {
  background: #fdfffe;
}
.tabtop {
  display: flex;
  border: $bg_color 1px solid;
  border-radius: 4px;
  margin: 0;
  > div {
    height: 40px;
    width: 190px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;

    .text {
      width: 188px;
      @include discen;
      line-height: 40px;
      color: $bg_color;
    }

    .active {
      width: 189px;
      @include discen;
      line-height: 40px;
      color: #ffffff;
      background: $bg_color;
      border-radius: 4px;
    }

    .hr {
      height: 20px;
      width: 2px;
      background: $bg_color;
    }
  }
}
</style>


